package com.gds.wiki.cloud.memberCenter.server.modular.member.api.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gds.wiki.cloud.framework.common.dto.ResponseDto;
import com.gds.wiki.cloud.framework.common.exception.BizExceptionEnum;
import com.gds.wiki.cloud.framework.common.utils.ResponseDtoFactory;
import com.gds.wiki.cloud.framework.web.common.BaseController;
import com.gds.wiki.cloud.memberCenter.client.member.api.MemberApi;
import com.gds.wiki.cloud.memberCenter.client.member.model.Member;
import com.gds.wiki.cloud.memberCenter.client.member.model.query.MemberQuery;
import com.gds.wiki.cloud.memberCenter.server.modular.member.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping(MemberApi.mapping)
public class MemberApiImpl extends BaseController implements MemberApi {

    @Autowired
    private MemberService memberService;

    @Override
    public ResponseDto<Member> getMember(MemberQuery memberQuery) {
        ResponseDto<Member> rs=ResponseDtoFactory.GetInstance().build(BizExceptionEnum.SUCCESSFUL_OPERATION);
        Wrapper<Member> wrapper=new QueryWrapper();
        rs.setData(memberService.getOne(wrapper));
        return rs;
    }

    @Override
    public ResponseDto<Page> getPage(MemberQuery memberQuery) {
//        memberService
        return ResponseDtoFactory.GetInstance().build(memberService.selectPage(memberQuery));
    }
}
